package com.ysj.demo.accompanynetwork.mvp.presenter;

import com.ysj.demo.accompanynetwork.bean.PartnerPost;
import com.ysj.demo.accompanynetwork.bean.RestRsp;
import com.ysj.demo.accompanynetwork.fragment.RentYourselfFragment;
import com.ysj.demo.accompanynetwork.mvp.common.OnCommonListener;
import com.ysj.demo.accompanynetwork.mvp.model.GetRentSelfModel;
import com.ysj.demo.accompanynetwork.mvp.view.RentYourselfView;
import com.ysj.demo.accompanynetwork.service.bean.PostSearchModel;
import com.ysj.demo.accompanynetwork.service.bean.page.Page;

/**
 * Created by 80530 on 2018/8/20.
 */

public class RentYourselfPresenter {
    private GetRentSelfModel getModel;

    private RentYourselfView mRentView;

    public RentYourselfPresenter() {
        getModel = new GetRentSelfModel();
    }

    public void bind(RentYourselfFragment rentView) {
        mRentView = rentView;
    }

    public void getList(String userId) {
        PostSearchModel postSearchModel = new PostSearchModel();
        postSearchModel.setUserid(userId);
        getModel.getSendSelfList(postSearchModel, new OnCommonListener() {
            @Override
            public void onSuccessListener(Object data) {
                mRentView.onResultSuccess((RestRsp<Page<PartnerPost>>) data);
            }

            @Override
            public void onFailListener(Throwable r) {
                mRentView.onFailListener("");
            }
        });
    }
}
